package com.hopes.bizz.basic.hazard.source.dto;


import com.hopes.bizz.basic.hazard.source.entity.HazHazardSourceEntity;
import com.hopes.boss.common.entity.BaseLogicEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.beans.BeanUtils;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @author daijie
 * @version 1.0
 * @date 2023/10/25 14:37
 * @Description:
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "重大危险源DTO")
public class HazHazardSourceDTO extends BaseLogicEntity {
    private static final long serialVersionUID = -1087295151288544049L;

    public HazHazardSourceEntity toPO() {
        HazHazardSourceEntity entity = new HazHazardSourceEntity();
        BeanUtils.copyProperties(this, entity);

        if (this.chemicalProcess != null && !this.chemicalProcess.isEmpty()) {
            StringBuilder builder = new StringBuilder();
            for (String id : this.chemicalProcess) {
                builder.append(id).append(",");
            }
            builder.deleteCharAt(builder.length() - 1);
            entity.setChemicalProcess(builder.toString());
        }

        return entity;
    }

    private Long id;

    private String hazardCode;

    private String hazardName;

    private String storageIds;

    private String shortName;

    private String hazardAddress;

    private BigDecimal floorArea;

    private String hazardType;

    private String hazardStep;

    private Boolean isHazardSource;

    private String hazardSourceLevel;

    private BigDecimal riskValue;

    private String longitude;

    private String latitude;

    private String altitude;

    private String hazardSourceLocation;

    private String hazardSourceScope;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date hazardUseDate;

    private Integer peopleNum;

    private Integer protectDistance;

    private Integer casualtyRadius;

    private Integer casualtyNum;

    private BigDecimal capacity;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date filingBegin;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date filingEnd;

    private Boolean chemicalProcessFlag;

    private List<String> chemicalProcess;

    private String hazardDesc;

    private String controlDesc;

    private String accidentSituation;

    private String remarks;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date identifyDate;

    private String identifyStatus;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date nextIdentifyDate;

    private Boolean isInPark;

    private String runningStatus;

    private Long controlUserId;

    private Long techUserId;

    private Long operateUserId;

    private Boolean monitorFlag;

    private String fillingPerson;

    private String img;

    private Long orgId;
}
